package com.example.maggie.meizinote.mvp.ui.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.maggie.meizinote.R;
import com.example.maggie.meizinote.app.MApp;
import com.example.maggie.meizinote.app.bean.ClassifyBean;
import com.example.maggie.meizinote.app.bean.note_item;

/**
 * Created by addis on 2018/4/21.
 */
public class HomeMenuAdapter extends BaseQuickAdapter<ClassifyBean, BaseViewHolder> {
    public HomeMenuAdapter() {
        super(R.layout.item_home_menu_note_classify);
    }

    @Override
    protected void convert(BaseViewHolder helper, ClassifyBean item) {
        if (item.getObjectId() == null || item.getObjectId().trim().isEmpty())
            helper.getView(R.id.menu_delect).setVisibility(View.GONE);
        helper.setText(R.id.menu_title, item.getTitle());
        helper.addOnClickListener(R.id.menu_delect);

        if (MApp.isNight) {
            helper.getView(R.id.list_item).setBackgroundColor(mContext.getResources().getColor(R.color.night_item_bg_color));
            ((TextView) helper.getView(R.id.menu_title)).setTextColor(mContext.getResources().getColor(R.color.night_txt_color));
        } else {
            helper.getView(R.id.list_item).setBackgroundColor(mContext.getResources().getColor(R.color.white));
            ((TextView) helper.getView(R.id.menu_title)).setTextColor(mContext.getResources().getColor(R.color.color_3));
        }
    }
}
